package com.ts.movie.controller;

import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class CorsController {

    @GetMapping("/cors/hello1")
    public Map<String, Object> hello1() {
        System.out.println("CorsController.hello1");
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);
        return map;
    }

    @PostMapping("/cors/hello2")
    @CrossOrigin(origins = "*")
    public Map<String, Object> hello2(@RequestBody Map<String, Object> param) {
        System.out.println("CorsController.hello2 ,param1:" + param);
        param.put("code", 300);
        return param;
    }
}
